package com.itheima.demoprivate;

public class Student {
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age >= 0 && age <= 120) {
            this.age = age;
        }else{
            System.out.println("您输入的数据不合法");
        }
    }

    public void show(){
        //在本类中无需使用get方法即可获取成员变量的数据
        System.out.println(name+"..."+age);//name和age前面都隐含了this关键字
    }
}
